﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ThietBiSo.LinQDB;
using ThietBiSo.Models;

namespace ThietBiSo.Controllers
{
    public class SEOController : Controller
    {
        //
        // GET: /SEO/

        MSeo ms = new MSeo();
        SEO f = new SEO();


        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult Index()
        {
            var v = ms.FindAll();
            ViewData["seos"] = v;
            return View();
        }

          

        [HttpPost]
        public ActionResult index(FormCollection collection)
        {
            try
            {


                f.Id = 1;
                f.Title = collection.Get("Title");
                f.Keywords = collection.Get("Keywords");
                f.Description = collection.Get("Description");
                ms.Update(f);
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

    }
}
